import request from '@/utils/request'
import type { ResApi, RoleListType, RoleListRes, AddRoleType, AssignAuthType } from '@/types/role'
// 1.封装获取角色列表数据接口
export const getRoleListApi = (params: RoleListType) => {
  return request<ResApi<RoleListRes[]>>({
    method: 'get',
    url: '/role/index',
    params,
  })
}

// 2.封装新增角色接口
export const addRoleApi = (data: AddRoleType) => {
  return request<ResApi<null>>({
    method: 'post',
    url: '/role/create',
    data,
  })
}

// 封装给角色分配权限接口
export const assignRoleAuthApi = (data: AssignAuthType) => {
  return request({
    method: 'put',
    url: '/role/assign',
    data,
  })
}
